<script>
init({
  title: 'Column Sorter',
  desc: 'Use `sorter` column option to custom the sorter.',
  links: ['bootstrap-table.min.css'],
  scripts: ['bootstrap-table.min.js']
})
</script>

<template>
  <table
    id="table"
    data-toggle="table"
    data-height="460"
    data-url="json/data1.json"
  >
    <thead>
      <tr>
        <th data-field="id">
          ID
        </th>
        <th data-field="name">
          Item Name
        </th>
        <th
          data-field="price"
          data-sortable="true"
          data-sorter="priceSorter"
        >
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<script>
  window.priceSorter = (a, b) => {
    const aa = a.replace('$', '')
    const bb = b.replace('$', '')

    return aa - bb
  }
</script>
